package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据ids查询steaml——dish表
     * @param dishIds
     * @return
     */
    // select setmeal_id from  setmeal_dish  where dish_id in (1, 2, 3, 4)
    List<Long> getSetmealIDsByDishIds(List<Long> dishIds);

    /**
     * 插入setmealdish
     * @param setmealDishes
     */
    void insertBatches(List<SetmealDish> setmealDishes);

    /**
     * 根据id删除关联的套餐
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);

    /**
     * 根据setmeal_id查询setmeal_dish
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getSetmealDishById(Long id);

}
